﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DnD.Core.Campaign;

namespace DnD.UI.Panels
{
    public partial class GroupInformation : BasePanel
    {
        private Group _group;
        public GroupInformation()
        {
            InitializeComponent();
        }
        public void LoadData(Group group)
        {
            _group = group;
            int totalHeight = 0;
            foreach (Player p in group.Players)
            {
                ShortPlayerInformation spi = new ShortPlayerInformation();
                spi.LoadData(p);
                spi.Top = totalHeight;
                spi.Width = Width;
                spi.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
                Controls.Add(spi);
                totalHeight += spi.Height;
            }
        }
        public override void RestackChildControls()
        {
            int totalHeight = 0;
            foreach (Control c in Controls)
            {
                ShortPlayerInformation spi = c as ShortPlayerInformation;
                if (spi != null)
                {
                    spi.RestackChildControls();
                }
                totalHeight += spi.Height;
            }
            Height = totalHeight;
//            Stacker.ReStack(this, 400, 1);
        }
    }
}
